/// @tags: Manacher
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <iostream>
#define rint register int

using std::cin;
using std::cout;

namespace BlueQuantum {

constexpr int maxn = 1.1e7 + 3;

char data[maxn << 1];
int p[maxn << 1], scnt;

inline void read() {
  char c = getchar();
  data[0] = '~', data[scnt = 1] = '|';
  while (!isalpha(c)) c = getchar();
  while (isalpha(c)) data[++scnt] = c, data[++scnt] = '|', c = getchar();
}

inline int main() {
  read();
  int ans = 0;
  for (int i = 1, r = 0, mid = 0; i <= scnt; ++i) {
    if (i <= r) p[i] = std::min(p[(mid << 1) - i], r - i + 1);
    while (data[i - p[i]] == data[i + p[i]]) ++p[i];
    if (p[i] + i - 1 > r) r = p[i] + i - 1, mid = i;
    ans = std::max(ans, p[i]);
  }
  cout << ans - 1;
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("manacher.in", "r", stdin);
  freopen("manacher.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
